<?php
	header("Content-type:text/html;charset=utf-8");
	$con = mysql_connect('localhost','root','1234');//连接数据库服务器
	mysql_select_db('test');//选择数据库
	mysql_query('set names utf8');

	//插入记录
	/*if(mysql_query('inser into pro1(id) values(12)')){
		echo "插入成功";
	}else{
		echo mysql_error();
		echo "插入失败";
	}

	echo "<br/>";

	//读取数据并输出   mysql_fetch_row()
	/*$query = mysql_query('select * from pro1');
	while($row = mysql_fetch_row($query)){
		print_r($row);
	}
	$query1=mysql_query('select *from pro1');
	echo 'mysql_fetch_row()';
	echo "<br/>";
	$row=mysql_fetch_row($query1);
	print_r($row);
	echo $row[1];
	echo "<br/>";
	$col = mysql_fetch_object($query1);
	print_r($col);
	echo "<br/>";
	//mysql_fetch_array()
	$query1=mysql_query('select *from pro1');
	echo 'mysql_fetch_array()';
	echo "<br/>";
	$a = mysql_fetch_array($query1,MYSQL_ASSOC);
	echo $a['id'];
	echo "<br/>";
	while($row=mysql_fetch_assoc($query1)){
		print_r($row);
		echo "<br/>";
	}
	echo "<br/>";
	echo mysql_num_rows($query1);
	echo "<br/>";



	//$query2 = mysql_query('select count(*) from pro1');
	//$arr = mysql_fetch_row($query2);
	//echo $arr[0];
	//echo mysql_result($query2, 0);
	$query2 = mysql_query('select * from pro1');
	echo mysql_result($query2, 1,'pname');
*/

	/*if(mysql_query('update pro1 set pname=3 where id=13')){
		echo "修改成功，修修改了条数为";
		echo mysql_affected_rows($con);//连接标识符
	}else{
		echo "修改失败";
	}*/


	if(mysql_query('update pro1 set pname=3 where id=13')){
		echo "修改成功，修修改了条数为";
		echo mysql_affected_rows($con);//连接标识符
	}else{
		echo "修改失败";
	}



	//断开数据库连接
	mysql_close();

?>